package models

import (
	"go.uber.org/zap/zapcore"
	"time"
)

type AdminModel struct {
	UsersModel `json:"-"`
	NickName   string `json:"nickname" gorm:"column:nickname"`
	EditorType string
}

type UsersModel struct {
	ID        int `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt time.Time `gorm:"index"`
	Username  string    `json:"username"`
	Password  string    `json:"password"`
	LoginAt   string
	Sign      string
	ImagePath string `json:"image_path"`
	Email     string `json:"email"`
}

func (ad *AdminModel) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	return ad.UsersModel.MarshalLogObject(enc)
}
func (us *UsersModel) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	enc.AddInt("id", us.ID)
	enc.AddString("username", us.Username)
	enc.AddString("password", us.Password)
	enc.AddString("login_at", us.LoginAt)
	return nil
}
